/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef __LOCK_MANAGER_H__
#define __LOCK_MANAGER_H__

#include "iot_profile.h"
/**
 * @brief defines the lock info for store.
 */
typedef struct {
    char id[LOCK_ID_SIZE];
    char password[LOCK_PSK_SIZE];
} LockInfo;

/**
 * @brief defines the check lock info for open lock.
 */
typedef struct {
    int disposable;
    int curSeconds;
    int curDay;
    LockInfo mLock;
} LockCheckInfo;

/**
 * @brief init LockManager mode
 * @param curWeekday Indicates the day of now.
 *
 * @return Returns 0 success while -1 failed
 */
int LockManagerInit(int curWeekday);

/**
 * @brief update the password for the lock.
 * @param paramPsk Indicates the lock info to update.
 *
 * @return Returns 1 success while 0 failed
 */
int LockManagerUpdate(CommandParamSetPsk *paramPsk);

/**
 * @brief Check the password for open the lock.
 * @param info Indicates the LockCheckInfo of lock.
 *
 * @return Returns 1 success while 0 failed
 */
int LockManagerCheckup(LockCheckInfo *info);

/**
 * @brief get the lcok numbers
 * @return Returns 0 success while -1 failed
 */
int LockManagerGetPskNum(void);

/**
 * @brief clear the lock's password
 * @return Returns the number of the lock password.
 */
int LockManagerClearPsk(void);

/**
 * @brief deinit LockManager mode
 */
void LockManagerDeinit(void);

#endif  /* __LOCK_MANAGER_H__ */
